﻿using System.ComponentModel;
using System.Windows.Input;
using WPFTemplateLib.Mvvm;
using WPFTemplateLib.WpfHelpers;

namespace WpfAnimationDemo.ViewModels
{
    public class SimpleAnimationViewModel : ViewModelBase
    {
        #region 绑定

        public double AngleA { get; set; }

        public bool IsAngleAChanging { get; set; }

        public double AngleB { get; set; }

        #endregion

        #region 命令

        private RelayCommand resetCmd;
        public ICommand ResetCmd => resetCmd ??= new RelayCommand(PerformResetCmd);
        private void PerformResetCmd(object commandParameter)
        {
            AngleA = 90;
            AngleB = 90;
        }

        #endregion

        #region 方法

        protected override void PropertyChangedHandle(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case nameof(AngleA):
                    IsAngleAChanging = true;
                    break;
            }
        }

        #endregion
    }
}
